import { ref, type Ref } from 'vue'
import { defineStore } from 'pinia'
import type { NavList } from '@/common/models/aigc-fix-panel';

export const useAppInfoStore = defineStore('appInfo', () => {
  const appInfo: Ref<NavList | null> = ref(null);

  const skin: Ref<string> = ref('light');

  function setAppInfo(payload: NavList) {
    appInfo.value = payload
  }

  function setSkin(payload: string) {
    skin.value = payload
  }

  function isClient() {
    if ((window as any).external && 'createObject' in (window as any).external && (window as any).cefQuery) {
      return true;
    }
    return false;
  }

  return { appInfo, setAppInfo, skin, setSkin, isClient }
})
